{% extends 'homepage.html' %}

{% block content %}

<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_util-functions.js') }}"></script>
<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_scripts.js') }}"></script>


<script type="text/javascript">
function get_dimension(evt) {
   evt.preventDefault();
   var val = $("#tabletype").val();
   for (i=1; i <= {{nrows}}+1; i=i+1)
   { 
     for (j=1; j <= {{ncols}}+1; j=j+1)
     { 
        var lab=i+"-"+j;
        $("#"+lab).load("{{ url_for('emf.return_dimension')}}"+"?level="+i+"&weight="+j+"&chi=0" + "&ttype=" + val, function() { });
   };
  };
};
function set_ncols(evt) {
   evt.preventDefault();
   var val = $("#ncols").val();
   $(#dimension_table).load("{{ url_for('emf.draw_table',nrows=nrows)}}"+"?ncols="+val,function(){});
  };

function set_nrows(evt) {
   evt.preventDefault();
   var val = $("#nrows").val();
   $(#dimension_table).load("{{ url_for('emf.draw_table',ncols=ncols)}}"+"?nrows="+val,function(){});
  };

$(function() {
  $("#tabletype").change(function(e) {table_handler(e)});
  get_dimension(event);
 };
$("#ncols").change(function(e) {set_ncols(e)});
  set_ncols(event);
 }
$("#nrows").change(function(e) {set_nrows(e)});
  set_nrows(event);
 }


);
</script>
<h1>Table of Dimensions </h1>
{% if nrows is defined and nrows > 0  %}
{% if ncols is defined and ncols > 0  %}
<table class="ntdata" id="dimension_table">
  <thead>
    <tr>
      <th>Level&nbsp;\Weight&nbsp;</th>
      {% for k in range(1,ncols+1) %}
      <th>{{k}}</th>
      {% endfor %}
    </tr>
  </thead>
  <tbody>
    {% for r in range(1,nrows+1) %}
    <tr><td>{{r}}</td>
      {% for k in range(1,ncols+1) %}
      <td><span id="{{r}}-{{k}}">?</span></td>
      {% endfor %}
    </tr>
    {% endfor %}
  </tbody>
</table>
<form>
 <select name="ttype" id="tabletype">
    <option value="new">Newforms</option>
    <option value="cusp">Cusp forms</option>
    <option value="modular">Modular Forms</option>
    <option value="eisenstein">Eisenstein series</option>
  </select>
 <select name="nrows" id="nrows">
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="30">30</option>
    <option value="50">50</option>
  </select>
 <select name="ncols" id="ncols">
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="30">30</option>
    <option value="50">50</option>
  </select>

 
</form>

{% endif %}
{% endif %}
{% endblock content %}
